package com.mes.defece.controller;

import com.mes.common.pojo.MESResult;
import com.mes.defece.service.ProcessService;
import com.mes.pojo.defece.ProcessPojo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author 侯伟豪
 * @Company 起点编程
 * @Description
 * @Time 2024/10/23 16:36
 */
@RestController
@CrossOrigin
@RequestMapping("/process")
public class ProcessController {
    @Autowired
    private ProcessService processService;
//    分页查询
    @GetMapping("/selectAll")
    public MESResult selectAll(ProcessPojo process, @RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer limit)
    {
        return processService.selectAll(process,page,limit);
    }
//    新增
    @PostMapping("/add")
    public MESResult add(@RequestBody ProcessPojo process)
    {
        return processService.addProcess(process);
    }
//    根据id查询信息
    @GetMapping("/selectById")
    public MESResult selectById(Long processId)
    {
        return processService.selectById(processId);
    }
//    根据id修改信息
    @PutMapping("/update")
    public MESResult update(@RequestBody ProcessPojo process)
    {
        return processService.updateProcessById(process);
    }
//    根据id删除信息
    @DeleteMapping("/delete")
    public MESResult deleteById(Long processId)
    {
        return processService.deleteById(processId);
    }
}